package de.westranger.forex.trading.genetic.allel.operator;

import java.text.ParseException;

public enum EvaluateTerminalSymbol {
	EMA_6_DOWN_TREND_3(0),
	EMA_6_UP_TREND_3(1),
	EMA_51_DOWN_TREND_3(2),
	EMA_51_UP_TREND_3(3),
	
	// jetzt kommen die negationen
	NOT_EMA_6_DOWN_TREND_3(4),
	NOT_EMA_6_UP_TREND_3(5),
	NOT_EMA_51_DOWN_TREND_3(6),
	NOT_EMA_51_UP_TREND_3(7),

	DO_NOT_USE_ME(666);
	
	private final int value;

	private EvaluateTerminalSymbol(final int value) {
		this.value = value;
	}

	public final int getValue() {
		return this.value;
	}
	
	public static final EvaluateTerminalSymbol parse(final int value) throws ParseException {
		EvaluateTerminalSymbol termSym;
		switch (value) {
		case 0:
			termSym = EvaluateTerminalSymbol.EMA_6_DOWN_TREND_3;
			break;
		case 1:
			termSym = EvaluateTerminalSymbol.EMA_6_UP_TREND_3;
			break;
		case 2:
			termSym = EvaluateTerminalSymbol.EMA_51_DOWN_TREND_3;
			break;
		case 3:
			termSym = EvaluateTerminalSymbol.EMA_51_UP_TREND_3;
			break;
		case 4:
			termSym = EvaluateTerminalSymbol.NOT_EMA_6_DOWN_TREND_3;
			break;
		case 5:
			termSym = EvaluateTerminalSymbol.NOT_EMA_6_UP_TREND_3;
			break;
		case 6:
			termSym = EvaluateTerminalSymbol.NOT_EMA_51_DOWN_TREND_3;
			break;
		case 7:
			termSym = EvaluateTerminalSymbol.NOT_EMA_51_UP_TREND_3;
			break;
		case 666:
			termSym = EvaluateTerminalSymbol.DO_NOT_USE_ME;
			break;			
		default:
			throw new ParseException(
					"could not parse EvaluateTerminalSymbol with the value " + value, 0);
		}
		return termSym;
	}
}
